/********************* BOOKS *********************/
//  Depends: modal.js

// Generic DB Object, impliments jQuery.Deferred
function BookDatabase(db) {
    this._db = db;
}

// Associated methods
jQuery.extend( BookDatabase.prototype, {
    exec: function( sql ) {
        var db = this._db;
        return jQuery.Deferred(function( defer ) {
            db.transaction(function( transaction ) {
                transaction.executeSql( sql, [],
                    function( transaction, result ) {
                        defer.resolveWith( transaction, [ result ] );
                    },
                    function( transaction, error ) {
                        defer.rejectWith( transaction, [ error, sql ] );
                    }
                )
            })
        }).promise();
    },
    init:      function() { console.log('"init" not Implimented.'); },
    allTags:   function() { console.log('"allTags" not Implimented.'); },
    savebook:  function() { console.log('"savebook" not Implimented.'); },
    clear:     function() { console.log('"clear" not Implimented.'); }
});